import java.util.Arrays;

class WashMachine {
    //属性 、 字段 、成员变量：这些成员变量是定义在方法外部 类的内部的
    public String brand; // 品牌
    public String type; // 型号
    public double weight; // 重量
    public double length; // 长
    public double width; // 宽
    public double height; // 高
    public String color; // 颜色

    //成员方法 -> 行为
    public void washClothes(){ // 洗衣服
        System.out.println("洗衣功能");
    }

    public void dryClothes(){ // 脱水
        System.out.println("脱水功能");
    }
    public void setTime(){ // 定时
        System.out.println("定时功能");
    }
}
class Dog {
    public String name;
    public String color;
    public int age;

    public void barks() {
        System.out.println(name + "：汪汪");
    }
    public void wag() {
        System.out.println(name + ": 摇尾巴~~~");
    }
}
public class test {
    public static void main(String[] args) {
        Dog dog1 = new Dog();
        dog1.name = "阿黄";
        dog1.age = 2;
        dog1.color = "黄色";
        System.out.println("年龄："+dog1.age);
        System.out.println("姓名："+dog1.name);
        System.out.println("颜色：" + dog1.color);
        dog1.barks();
        dog1.wag();

        System.out.println();

        Dog dog2 = new Dog();
        dog2.name = "旺财";
        dog2.age = 3;
        dog2.color = "黑色";
        System.out.println("年龄："+dog2.age);
        System.out.println("姓名："+dog2.name);
        System.out.println("颜色："+dog2.color);
        dog2.barks();
        dog2.wag();

        //我可以通过new 关键字 来实例化 多个对象
        Dog dog3 = new Dog();
        Dog dog4 = new Dog();
        Dog dog5 = new Dog();
    }
    public static void main7(String[] args) {
        int[] nums = {2,6,4,1};
        int num = 0;
        boolean kk = false;
        for(int i = 0;i < nums.length ; i++) {
            if(nums[i]%2 == 1) {
                num++;
            }else {
                num = 0;
            }

            if(num == 3) {
                kk = true;
                System.out.println("true");
                break;
            }
        }
        if(kk == false) {
            System.out.println("false");
        }
    }
    public static void main6(String[] args) {
        int[] nums = {4,1,2,1,2};
        int num = nums[0];
        for(int i = 1; i < nums.length; i++) {
            num ^= nums[i] ;
        }
        System.out.println(num);
    }
    public static void main5(String[] args) {
        int[] nums = {2,7,11,15};
        int target = 9;
        for(int i = 0; i < nums.length; i++){
            for(int j = i; j<nums.length; j++) {
                if(nums[i]+nums[j]==target) {
                    System.out.println("["+i+","+j+"]");
                    break;
                }
            }
        }
    }
    public static void main4(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int j = arr.length-1;
        for(int i = 0; i<arr.length/2; i++) {
            if(arr[i]<arr[j] && arr[i]%2 == 0 && arr[j]%2== 1) {
                int tmp = arr[i];
                arr[i] = arr[j];
                arr[j] = tmp;
            }
            j--;
        }
        System.out.println(Arrays.toString(arr));
    }
    public static int sum(int[] arr) {
        int sum = 0;
        for(int i = 0; i < arr.length ; i++) {
            sum += arr[i];
        }
        return sum;
    }
    public static void main3(String[] args) {
        int[] arr = {1,2,3};
        System.out.println(sum(arr));

    }
    public static void transform(int arr[]) {
        for(int i = 0 ;i < arr.length;i++) {
            arr[i] *=2;
        }
    }

    public static void main2(String[] args) {
        int[] arr = {1,2,3};
        transform(arr);
        System.out.println(Arrays.toString(arr));

    }
    public static void main1(String[] args) {
        int[] arr = new int[100];
        int num = 1;
        for(int i = 0;i<=99;i++) {
            arr[i] = num;
            num++;
        }
        System.out.println(Arrays.toString(arr));
    }
}
